import { createParamDecorator, ExecutionContext } from "@nestjs/common";

export const CurrentUserId = createParamDecorator(
  (data: unknown, ctx: ExecutionContext) => {
    const request = ctx.switchToHttp().getRequest();

    // 修复：应该返回 userId 而不是 request.user?.userId
    return request.user?.userId; // 获取 JwtStrategy validate 返回的 userId
  }
);
